package demo.actions;

import org.apache.struts2.ServletActionContext;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Result;

import com.opensymphony.xwork2.ActionSupport;

import demo.service.DemoService;

@SuppressWarnings("serial")

public class DemoAction extends ActionSupport {
	
	private DemoService demoService;
	
	
	public void setDemoService(DemoService demoService) {
		this.demoService = demoService;
	}


	/**
	 * 
	 * @return
	 */
	@Action(value="foo",results={@Result(name="success", location="/test.jsp", type="dispatcher")})
	public String foo() {
		ServletActionContext.getRequest().setAttribute("message", demoService.saySomething());
		return "success";
	}
}
